package com.woparker.kiosk.utils;

import android.content.res.Resources;
import android.graphics.BitmapFactory;

public class BitmapUtils {

    public static float RATIO = 1;

    public static int[] getImageSizeFromResource(Resources resources, int resourceId) {
        // 创建 BitmapFactory.Options 对象
        BitmapFactory.Options options = new BitmapFactory.Options();

        // 设置 inJustDecodeBounds 为 true，只加载图片的边界信息
        options.inJustDecodeBounds = true;

        // 加载图片的边界信息
        BitmapFactory.decodeResource(resources, resourceId, options);

        // 获取原始宽度和高度
        int width = options.outWidth;
        int height = options.outHeight;

        // 返回宽度和高度
        return new int[]{width, height};
    }
}
